/*		Filename: 	fee_manager.cpp
 *		Author:		彭望
 *		Date:		2012-01-11
 *		Use:		具体实现费用管理器对象
 */

#include "fee_manager.h"

CFeeManager::CFeeManager(const CCardManagerPtr& ptr)
		:m_cmPtr(ptr),
		 logger(Logger::getLogger())
{
}


RetCode_t CFeeManager::change_balance(CCardInfo& info,  double delta)
{
	RetCode_t ret = m_cmPtr->check_card(info);
	if( RET_OK != ret )
	{
			logger.warn("in %s : check card failed! card id : %s, delta : %lf",

							__func__, info.get_cardId().c_str(), delta);
	}
	info.set_balance( info.get_balance() + delta );
	return m_cmPtr->update_card(info);
}

